<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />

    <link rel="stylesheet" type="text/css" href="/admin/static/h-ui/css/H-ui.css" />
    <link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="/admin/lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/css/style.css" />

    <link rel="stylesheet" type="text/css" href="/pdfh5-master/css/pdfh5.css" />

</head>

<body>
    <div class="hidden">
        {{$gqjID = DB::table('setting')->where('id', '1')->value('enable_tool_ID')}}
    </div>
    <div class="page-container" style="height: 700px">
        <a class="btn btn-primary radius size-MINI" href="javascript:;" onclick="download_report({{$sample_info_data->id}},0,1,1)" style='margin-bottom:5px' ><i class="Hui-iconfont">&#xe640;</i>查看相关检测报告</a>
        <!--div class="mb-15">
            <div class="f-l" style="width:50%">
                <b>送检单位：</b>{{ $gaiyao_data->client_name }}<br>
                <b>样品名称：</b>{{ $gaiyao_data->tool_name }}<br>
                <b>条 形 码：</b><span style="color:red;font-size:18px;">{{ $sample_info_data->bar_code }}</span><br>
                @if($gqjID)
                    <b>工器具ID：</b><span style="color:red;">{{ $sample_info_data->gqj_ID }}</span><br>
                @endif
                <b>检验标准：</b>{{ $gaiyao_data->std_num }}<br>
                <b>额定电压：</b>{{ $gaiyao_data->voltage }}<br>
                <b>分　　类：</b>{{ $gaiyao_data->class }}<br>
                <b>样品状态：</b>{{ $sample_info_data->sample_status }}<br>
            </div>
            <div class="f-l" style="width:50%">
                <b>自 编 号:</b>{{ $sample_info_data->self_num }}<br>
                <b>生产厂家：</b>{{ $sample_info_data->manufacturer }}<br>
                <b>生产日期：</b>{{ $sample_info_data->production_date }}<br>
                <b>规格型号：</b>{{ $sample_info_data->guige_xinghao }}<br>
                <b>商　　标：</b>{{ $sample_info_data->brand }}<br>
                <b>检验周期：</b>{{ $cycle }}年<br>
                <b>试验日期：</b>{{ $sample_info_data->test_time }}<br>
                <b>@if(config('constant.app_name') == 'SiChuanTongZhou') 下次试验日期： @else 有效期至： @endif</b>{{ $sample_info_data->next_time }}<br>
            </div>
            <div style="clear:both"></div>
        </div>
        <ul id="Huifold" class="Huifold" style="padding-bottom: 10px">
            @foreach ($items_data as $val){{-- 第一层循环 --}}
            <li class="item mt-5">
                <h4>
                    {{ $val->name }}
                    @if ($val->res === 1)
                        <span class="badge badge-success radius">符合</span>
                    @elseif ($val->res === 0)
                        <span class="badge badge-danger radius">不符合</span>
                    @endif
                    {{-- <b>+</b> --}}
                </h4>
                @if($val->res === 0)
                    <b>　　　　</b><b>备注：</b><span class="down-line">{{ $val->remark }}</span>
                @endif
                <input type="hidden" name="item_id" value="{{ $val->id }}">
            </li>
            @endforeach
        </ul-->
        <!--第一种方式 'http://test.baiyin.com/storage/reports/220001.docx ，直接第三方在线插件，有些需要收费，需要将文档上传到他们服务器-->
    <!--<iframe src="https://view.officeapps.live.com/op/embed.aspx?src={{asset('storage/'.$storeFile)}}" width='100%' height='600px' frameborder='0'></iframe>
        <iframe src="https://api.idocv.com/view/url?url={{asset('storage/'.$storeFile)}}" width="100%" height="600px" frameborder='1'></iframe>-->
        <!--<iframe src="https://view.xdocin.com/view?src={{asset('storage/'.$storeFile)}}" width="100%" height="600px" frameborder='1'></iframe>-->


        <!--第二种方式，将docx转为html，然后iframe加载-->
        <iframe src="{{asset('storage/'.$docpath)}}" width="100%" height="700px" id="doc_iframe"><p>您的浏览器不支持iframe标签。</p></iframe>

        <!--第三种方式pdf显示-->
        <div id="pdfview"></div>

    </div>
    <!--<script src="https://cdn.bootcdn.net/ajax/libs/mammoth/1.6.0/mammoth.browser.min.js"></script>
    <script src="https://unpkg.com/jszip/dist/jszip.min.js"></script>
    <script src="https://unpkg.com/docx-preview/dist/docx-preview.min.js"></script>-->
    <script src="/pdfh5-master/js/pdf.js" type="text/javascript" charset="utf-8"></script>
    <script src="/pdfh5-master/js/pdf.worker.js" type="text/javascript" charset="utf-8"></script>
    <script src="/pdfh5-master/js/jquery-3.6.0.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="/pdfh5-master/js/pdfh5.js" type="text/javascript" charset="utf-8"></script>
    <script>
        /*第三种pdf方式
        var url = "http://test.baiyin.com/storage/reports/220001.pdf";
        var pdfh5 = new Pdfh5('#pdfview', {
            pdfurl: url
        });*/
        $(function(){
            // 获取iframe元素
            var iframe = document.getElementById('doc_iframe');

            // 等待iframe加载完成
            iframe.onload = function() {
                // 获取iframe的document对象
                var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;

                // 设置body样式，缩放
                iframeDoc.body.style.zoom = '0.5';
                $(iframeDoc.body).find('img').each(function(){
                    $(this).css('zoom','0.5');
                })
                // iframeDoc.body.style.overflow = 'auto'; // 如果需要滚动条的话
            };
            iframe.width = '100%';
        })
        /*下载报告*/
        function download_report(id, pdf = 0, sample=0, down=0) {
            window.open('/{{config('constant.name_admin')}}/viewRes/exportReport/export?id=' + id + '&toPdf=' + pdf + '&sample='+sample + '&down=' + down, '_blank');
        }
    </script>

</body>

</html>